package com.xuecheng.test.demo.dailimoshi;

public class Main {
    public static void main(String[] args) throws Exception {
        //实现静态代理
        ProxySubject proxySubject = new ProxySubject(new RealSubject());
        System.out.println(proxySubject.result("静态代理"));


        //实现动态代理
        Subject subject = new RealSubject();
        Subject sb = (Subject) new ProxyFactory(subject).getProxyInstance();
        String s = sb.result("动态代理");
        System.out.println(s);
    }
}
